<?php
// +----------------------------------------------------------------------
// | ManniuRead
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://manniuyun.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: heitao <read@manniuyun.com>
// +----------------------------------------------------------------------

namespace app\book\controller\member;

use app\book\base\BookMemberBase;

use app\member\model\Member;

class Register extends BookMemberBase{
	/**
     * 会员注册
     * @access public
     * @return \think\Response
     */
    public function index(Member $member){
    	if($this->request->isPost()){
            if($this->request->param('password') != $this->request->param('confirm_password')){
                $this->error('两次输入的密码不同','book/member.Register/index');
            }
            if($member->register($this->buildParam())){
                $this->success('注册成功', 'book/member.Login/index');
            }else{
                // 验证失败 输出错误信息
                $this->error($member->getError(),'book/member.Register/index');
            }
    	}
        return $this->getTemplate();
    }
}